package com.wardrobe.soa.api.address;

import com.wardrobe.domain.address.AddressBean;
import com.wardrobe.soa.common.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2018/11/14.
 */
@RestController
@RequestMapping("/api/address")
public class ApiAddressController {
    @Autowired
    private ApiAddressService apiAddressService;

    @RequestMapping("/getAddressList")
    public ApiResult getAddressList(long userId) {
        return apiAddressService.getAddressList(userId);
    }

    @RequestMapping("/getDefaultAddress")
    public ApiResult getDefaultAddress(long userId) {
        return apiAddressService.getDefaultAddress(userId);
    }

    @RequestMapping("/modifyDefaultAddress")
    public ApiResult modifyDefaultAddress(AddressBean addressBean) {
        return apiAddressService.modifyDefaultAddress(addressBean);
    }

    @RequestMapping("/saveAddress")
    public ApiResult saveAddress(AddressBean addressBean) {
        return apiAddressService.saveAddress(addressBean);
    }

    @RequestMapping("/deleteAddress")
    public ApiResult deleteAddress(long id){
        return apiAddressService.deleteAddress(id);
    }
}
